package day07;

import java.util.ArrayList;
import java.util.Scanner;

public class StudentHomework {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        ArrayList <Student> students = new ArrayList<>();
        
        while (true){
            System.out.println("请选择（1.录入； 0.退出；）");
            int choice = scanner.nextInt();
            if (choice ==1) {
                System.out.println("请输入学生姓名");
                String name = scanner.next();
                System.out.println("请输入学生年龄");
                int age = scanner.nextInt();

                day07.Student student = new day07.Student();
                student.setName(name);
                student.setAge(age);

                students.add(student);
            }else if (choice == 0){
                for (int i = 0; i < students.size(); i++) {
                    Student student = students.get(i);
                    System.out.println(student.getName() + "---" + student.getAge());
                }
            }        
            
            
        }

       
       
    }
}
